package com.androidserver.server;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.androidserver.util.DatastoreWrapper;

@SuppressWarnings("serial")
public class DeleteGroup extends HttpServlet {

	public void doGet(HttpServletRequest req, HttpServletResponse resp)
	throws IOException {
		
		if (!req.getHeader("User-Agent").contains("Android")) {
			resp.getWriter().print("No browser access");
			return;
		}
		
		DatastoreWrapper dataWrapper = DatastoreWrapper.getInstance();
		if (dataWrapper.removeGroup(req.getParameter("groupName"), req.getParameter("ownerID"))) {
			resp.getWriter().println("OK");
		} else resp.getWriter().println("FAIL");
	}
}
